package com.SunSoft.PhoneRemoteControl;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class MyApplication extends Application
{
  private static MyApplication s;
  public boolean a = false;
  public boolean b = false;
  public boolean c = false;
  public boolean d = false;
  public boolean e = false;
  public boolean f = false;
  public boolean g = true;
  public boolean h = false;
  public boolean i = false;
  public boolean j = false;
  public String k = "";
  public Intent l;
  public int m = 1;
  public String n = "";
  public String o = "";
  public boolean p = true;
  public boolean q = false;
  public int r = 0;
  private List t = new LinkedList();

  public static MyApplication a()
  {
    if (s == null)
      s = new MyApplication();
    return s;
  }

  public static void a(String paramString1, String paramString2)
  {
    if (!(MainControl.e))
      return;
    Log.d(paramString1, paramString2);
  }

  public final void a(Activity paramActivity)
  {
    this.t.add(paramActivity);
  }

  public final void a(boolean paramBoolean, Context paramContext)
  {
    int i1 = 1;
    int i2 = 8;
    while (true)
    {
      try
      {
        Object localObject = Class.forName("android.media.AudioManager");
        paramContext = ((Class)localObject).getConstructor(new Class[] { Context.class }).newInstance(new Object[] { paramContext });
        localObject = ((Class)localObject).getMethod("setWiredDeviceConnectionState", new Class[] { Integer.TYPE, Integer.TYPE, String.class });
        if (!(paramBoolean))
          break label130;
        if (this.b)
          i2 = 4;
        if (!(paramBoolean))
          this.c = true;
        ((Method)localObject).invoke(paramContext, new Object[] { Integer.valueOf(i2), Integer.valueOf(i1), "h2w" });
        return;
      }
      catch (Exception paramContext)
      {
        paramContext.printStackTrace();
        return;
      }
      label130: i1 = 0;
    }
  }

  public final void b()
  {
    Iterator localIterator = this.t.iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
      {
        System.exit(0);
        return;
      }
      ((Activity)localIterator.next()).finish();
    }
  }
}